package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.Before;
import org.junit.Test;

public class RecipeTest extends TestCase{

	public Recipe rc;
	public Recipe rc2;

	@Before
	public void setUp() throws Exception {
		rc = new Recipe();
		rc2 = new Recipe();
	}

	@Test
	public void testSetAmtCoffee1() {
		rc.setAmtCoffee(-1);
		assertEquals(0, rc.getAmtCoffee());
		rc.setAmtCoffee(0);
		assertEquals(0, rc.getAmtCoffee());
		rc.setAmtCoffee(3);
		assertEquals(3, rc.getAmtCoffee());
	}

	@Test
	public void testSetAmtMilk1() {
		rc.setAmtMilk(-1);
		assertEquals(0, rc.getAmtMilk());
		rc.setAmtMilk(0);
		assertEquals(0, rc.getAmtMilk());
		rc.setAmtMilk(1);
		assertEquals(1, rc.getAmtMilk());
	}

	@Test
	public void testSetAmtSugar1() {
		rc.setAmtSugar(-1);
		assertEquals(0, rc.getAmtSugar());
		rc.setAmtSugar(0);
		assertEquals(0, rc.getAmtSugar());
		rc.setAmtSugar(1);
		assertEquals(1, rc.getAmtSugar());
	}
	
	@Test
	public void testSetAmtChocolate1() {
		rc.setAmtChocolate(-1);
		assertEquals(0, rc.getAmtChocolate());
		rc.setAmtChocolate(0);
		assertEquals(0, rc.getAmtChocolate());
		rc.setAmtChocolate(10);
		assertEquals(10, rc.getAmtChocolate());
	}

	@Test
	public void testSetPrice1() {
		rc.setPrice(-1);
		assertEquals(0, rc.getPrice());
		rc.setPrice(50);
		assertEquals(50, rc.getPrice());
	}

	@Test
	public void testSetName1() {
		rc.setName("Coffee");
		assertEquals("Coffee", rc.getName());
	}

	@Test
	public void testEquals1() {
		assertFalse(rc.equals(rc2));

		rc2.setName("Coffee");
		assertFalse(rc.equals(rc2));

		rc.setName("Coffee");
		assertTrue(rc.equals(rc2));

		rc.setName("Cafe Mocha");
		assertFalse(rc.equals(rc2));
	}

	@Test
	public void testToString1() {
		rc.setName("Coffee");
		assertEquals("Coffee", rc.toString());
	}
}
